/*
 * Object.cpp
 *
 *  Created on: 4 mars 2013
 *      Author: Raphaël
 */
#include <sstream>
#include <utility>
#include "Object.h"

namespace raph
{
/*-------------------------------------------------------------------
 attributs
 -------------------------------------------------------------------*/
type::T_UINT32 Object::NB_INSTANCES = 0;

/*-------------------------------------------------------------------
 constructor/destructor
 -------------------------------------------------------------------*/
Object::Object()
    {
    NB_INSTANCES++;
    }

Object::Object(const Object&)
    {
    NB_INSTANCES++;
    }

Object& Object::operator =(const Object&)
    {
    return *this;
    }

Object::~Object()
    {
    NB_INSTANCES--;
    }

/*-------------------------------------------------------------------
 public methods
 -------------------------------------------------------------------*/
std::string Object::toString()
    {
    std::ostringstream oss;
    oss << this;
    std::string str = oss.str();
    return str;
    }

Object* Object::cloneOf() const
    {
    return new Object(*this);
    }

bool Object::equals(const Object& obj)
    {
    return this == &obj;
    }
/*-------------------------------
 static
 -------------------------------*/
type::T_UINT32 Object::getNbInstances()
    {
    return NB_INSTANCES;
    }
/*-------------------------------
 friend methods
 -------------------------------*/
std::ostream& operator <<(std::ostream& print, Object& obj)
    {
    print << obj.toString();
    return print;
    }

}
